<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title site-title">
		<legend>
			<a name="fixbar" style="font-size: 16px; color: #ce2424;">分组名单 ${c}</a>
		</legend>
	</fieldset>
<script type="text/html" id="toolbargroup">
	<form class="layui-form" id="myForms" action="javascript:;" lay-filter="stuform">
		<input type="text" style="display: none;" />
			<div class="layui-inline">
				<label class="layui-form-label" style="width:100px">查询内容:</label>
				<div class="layui-input-block">
					<input type="text" name="search" id="searchvalue" value="${search}" onkeypress="return onKeyPress(event)" class="layui-input" />
				</div>
			</div>
			<div class="layui-inline">
				<button class="layui-btn layui-btn-sm" onclick="searc()" style="margin-left: 16px"><i class="fa fa-search"></i>查询</button>
			</div>
		</form>
</script>
<table class="layui-hide" id="group"></table>
<script>
layui.use('table', function(){
  var table = layui.table;
  
  table.render({
	height:'full-215',
    elem: '#group'
    ,url:'schoolmate/grouppage'
	,toolbar: '#toolbargroup'
	,id:"grouppages"
    ,limit: 20
    ,defaultToolbar: ['filter', 'print', 'exports']
    ,page:true
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
    ,cols: [[
      {field:'groupNumber', title: '组号', width:90,align:'center',sort:true}
      ,{field:'name', width:80, title: '姓名'}
      ,{field:'sex', width:80, title: '性别'} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
      ,{field:'siteNumber', title: '座位号'}
      ,{field:'position', title: '职务'}
      ,{field:'workUnit', width:137, title: '工作单位', width: '30%', minWidth: 100}
    ]]
  });
  	
});

function searc(){
	var table = layui.table;
	var muform=$("#myForms").serializeObject();
	
	var searchvalue = $("input[name='search']").val();
	table.reload("grouppages",{where:muform});
	
	/**防止刷新表格把查询条件也删除了**/
	$("input[name='search']").val(searchvalue);
	$("input[name='search']").select();
	$(function(){
		$("input[name='search']").focus();
	});
}
	

function onKeyPress(event){
	if(event.keyCode==13){
		searc();
	}
}
</script>
</body>
</html>